// Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
package cci

//Defines the request parameter object used for creating CCI instances.

// AuthorizationInfo -- cci api authorization
type AuthorizationInfo struct {
	AK       string `json:"ak"`
	SK       string `json:"sk"`
	RegionId string `json:"regionId"`
}

// NameSpaceRequest -- create namespace request body
type NameSpaceRequest struct {
	ApiVersion string            `json:"apiVersion"`
	Kind       string            `json:"kind"`
	Metadata   NameSpaceMetadata `json:"metadata"`
}
type NameSpaceMetadata struct {
	Annotations NamespaceAnnotations `json:"annotations"`
	Name        string               `json:"name"`
}
type NamespaceAnnotations struct {
	NamespaceKubernetesIoFlavor string `json:"namespace.kubernetes.io/flavor"`
}

// NetWorkRequest -- create network request body
type NetWorkRequest struct {
	ApiVersion string          `json:"apiVersion"`
	Kind       string          `json:"kind"`
	Metadata   NetWorkMetadata `json:"metadata"`
	Spec       NetWorkSpec     `json:"spec"`
}
type NetWorkMetadata struct {
	Annotations NetworkAnnotations `json:"annotations"`
	Name        string             `json:"name"`
}
type NetworkAnnotations struct {
	NetworkAlphaKubernetesIoDomainId             string `json:"network.alpha.kubernetes.io/domain-id"`
	NetworkAlphaKubernetesIoProjectId            string `json:"network.alpha.kubernetes.io/project-id"`
	NetworkAlphaKubernetesIoDefaultSecurityGroup string `json:"network.alpha.kubernetes.io/default-security-group"`
}
type NetWorkSpec struct {
	AttachedVPC string `json:"attachedVPC"`
	NetworkID   string `json:"networkID"`
	NetworkType string `json:"networkType"`
	SubnetID    string `json:"subnetID"`
}

// PodRequest -- create pod request body
type PodRequest struct {
	ApiVersion string      `json:"apiVersion"`
	Kind       string      `json:"kind"`
	Metadata   PodMetadata `json:"metadata"`
	Spec       PodSpec     `json:"spec"`
}
type PodMetadata struct {
	Labels      PodMetadataLabels      `json:"labels"`
	Name        string                 `json:"name"`
	Annotations PodMetadataAnnotations `json:"annotations"`
}
type PodMetadataAnnotations struct {
	YangtseIoPodWithEip       string `json:"yangtse.io/pod-with-eip"`
	YangtseIoEipBandwidthSize string `json:"yangtse.io/eip-bandwidth-size"`
	YangtseIoEipNetworkType   string `json:"yangtse.io/eip-network-type"`
	YangtseIoEipChargeMode    string `json:"yangtse.io/eip-charge-mode"`
	YangtseIoEipBandwidthId   string `json:"yangtse.io/eip-bandwidth-id"`
}
type PodMetadataLabels struct {
	Name string `json:"name"`
}
type PodSpec struct {
	Containers       []PodSpecContainers       `json:"containers"`
	ImagePullSecrets []PodSpecImagePullSecrets `json:"imagePullSecrets"`
	Priority         int                       `json:"priority"`
	RestartPolicy    string                    `json:"restartPolicy"`
}
type PodSpecContainers struct {
	Env             []PodSpecContainersEnv     `json:"env"`
	Image           string                     `json:"image"`
	ImagePullPolicy string                     `json:"imagePullPolicy"`
	Name            string                     `json:"name"`
	Resources       PodSpecContainersResources `json:"resources"`
}
type PodSpecContainersEnv struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}
type PodSpecContainersResources struct {
	Limits   PodSpecContainersResourcesLimits   `json:"limits"`
	Requests PodSpecContainersResourcesRequests `json:"requests"`
}
type PodSpecContainersResourcesLimits struct {
	Cpu    string `json:"cpu"`
	Memory string `json:"memory"`
}
type PodSpecContainersResourcesRequests struct {
	Cpu    string `json:"cpu"`
	Memory string `json:"memory"`
}
type PodSpecImagePullSecrets struct {
	Name string `json:"name"`
}

type PodPrivateBandwidthRequest struct {
	CCICommonParameter
	Metadata PrivateBandwidthMetaData `json:"metadata"`
}

type PodSharedBandwidthRequest struct {
	CCICommonParameter
	Metadata SharedBandwidthMetaData `json:"metadata"`
}
type CCICommonParameter struct {
	ApiVersion string  `json:"apiVersion"`
	Kind       string  `json:"kind"`
	Spec       PodSpec `json:"spec"`
}

// Metadata
type PrivateBandwidthMetaData struct {
	Labels      PodMetadataLabels           `json:"labels"`
	Name        string                      `json:"name"`
	Annotations PrivateBandwidthAnnotations `json:"annotations"`
}
type SharedBandwidthMetaData struct {
	Labels      PodMetadataLabels          `json:"labels"`
	Name        string                     `json:"name"`
	Annotations SharedBandwidthAnnotations `json:"annotations"`
}

// Metadata--Annotations
type PrivateBandwidthAnnotations struct {
	YangtseIoPodWithEip       string `json:"yangtse.io/pod-with-eip"`
	YangtseIoEipBandwidthSize string `json:"yangtse.io/eip-bandwidth-size"`
	YangtseIoEipNetworkType   string `json:"yangtse.io/eip-network-type"`
	YangtseIoEipChargeMode    string `json:"yangtse.io/eip-charge-mode"`
}

type SharedBandwidthAnnotations struct {
	YangtseIoPodWithEip     string `json:"yangtse.io/pod-with-eip"`
	YangtseIoEipBandwidthId string `json:"yangtse.io/eip-bandwidth-id"`
}
